// Package ioc
/**
* @Project : geektime-basic-go-study
* @File    : log.go
* @IDE     : GoLand
* @Author  : Tvux
* @Date    : 2024/11/5 10:19
**/

package ioc

import (
	"github.com/HJH0924/GenericGo/logger"
	"github.com/spf13/viper"
	"go.uber.org/zap"
)

func InitZapLogger() logger.Logger {
	// 直接使用 zap 本身的配置结构体
	conf := zap.NewDevelopmentConfig()
	err := viper.UnmarshalKey("log", &conf)
	if err != nil {
		panic(err)
	}
	zapLogger, err := conf.Build()
	if err != nil {
		panic(err)
	}
	return logger.NewZapLogger(zapLogger)
}
